<?
include_once ("_data.php");


if ($order=="name") 
{
	$sql1 = "SELECT id FROM $db_table ORDER BY name ASC";
} else 
{
	$sql1 = "SELECT id FROM $db_table ORDER BY score DESC";
}
$result1 = mysql_query($sql1);

if (!$flash) {
	
		$HTM_1 = "<table cellpadding='0' cellspacing='0' border='0' width=" . $table_width . ">
		  <tbody>
		  <tr align=center><td>" . $table_prop . "<tr align=center> 
		<th bgcolor='" . $t_color . "'>" . $t_font . "#</font></th>
		<th bgcolor='" . $t_color . "'>" . $t_font . "Name</font></th>
		<th bgcolor='" . $t_color . "'>" . $t_font . "Score</font></th>
		</tr>";
	
	echo "$HTM_1";
}

$num = 1;
while($r = mysql_fetch_object($result1))
{
	$result = mysql_db_query($db_name,"SELECT * from $db_table WHERE id='{$r->id}'");
	$resultArray = mysql_fetch_array($result);
	$name = $resultArray["name"];
	$score = $resultArray["score"];
	
		if ($num<=100) {
			if ($flash) {
				echo "&name$num=$name&score$num=$score";
			} else {
				$HTML = "
				<tr bgcolor='" . $m_color . "' align='center'><td>" . $m_font . $num . "</td>
				<td>" . $m_font . $name . "</font></td>
				<td>" . $m_font . $score . "</font></td>
				</tr>";
				echo "$HTML";
			}
			$num++;
		}
	
}
if (!$flash) {
	
		$HTM_2 = "</tbody></table>
		</td></tr>
		  <tr align=center>
		    <th bgcolor='" . $t_color . "'>" . $t_font . "Top " . $sec_size . "</font></th>
		</tr></tbody></table>";
	
	echo "$HTM_2";
}

mysql_close ($conn);
?>
